package tbalert.web.action;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import tbalert.session.SessionProvider;
import tbalert.web.SysConstants;
import tbalert.web.entity.Dwdm;
import tbalert.web.manager.BrxxMng;

@Controller
public class WelcomeAct {
	@RequestMapping("/index.do")
	public String index() {
		return "index";
	}

	@RequestMapping("/top.do")
	public String top(HttpServletRequest request, ModelMap model) {
		model.addAttribute(SysConstants.DWDM_KEY, session.getAttribute(request,
				SysConstants.DWDM_KEY));
		return "top";
	}

	@RequestMapping("/center.do")
	public String center() {
		return "center";
	}

	@RequestMapping("/down.do")
	public String down() {
		return "down";
	}

	@RequestMapping("/left.do")
	public String left(HttpServletRequest request, ModelMap model) {
		Dwdm dwdm = (Dwdm) session.getAttribute(request, SysConstants.DWDM_KEY);
		model.addAttribute("role", dwdm.getRole());
		model.addAttribute("unsubmit", brxxMng.unfinished(dwdm.getDwid()));
		return "left";
	}

	@RequestMapping("/welcome.do")
	public String welcome() {
		return "welcome";
	}

	@Autowired(required = true)
	private BrxxMng brxxMng;
	@Autowired(required = true)
	private SessionProvider session;
}
